package ca.swank.hq.optimized;

import ca.swank.hardquor.*;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.Comparator;
// for putting coordinates in linked lists
import gnu.trove.TLinkable;

/**
 * An coordinate on the optimized board
 *
 * @author Jesse Wilson
 * @version 2.0 13-Aug-2002
 */
public class Coord implements TLinkable
{
  // the x value of this coordinate
  public final int x;
  // the y value of this coordinate
  public final int y;

  // the coordinates in each of the specified directions
  private Coord[] CoordInDirection;

  // links for putting coords in a linked list
  TLinkable troveLinkableNext;
  TLinkable troveLinkablePrevious;

  public Coord(int x, int y)
  { this.x = x;
    this.y = y;
    CoordInDirection = new Coord[hardquorBoard.DIR_CRISSCROSS + 1];
  }

  public int getX()
  { return x;
  }

  public int getY()
  { return y;
  }

  public Coord getCoordInDirection(int direction)
  { return CoordInDirection[direction];
  }

  public void setCoordInDirection(int direction, Coord coord)
  { CoordInDirection[direction] = coord;
  }

  /**
   * Returns the linked list node after this one.
   */
  public TLinkable getNext()
  { return troveLinkableNext;
  }

  /**
   * Returns the linked list node before this one.
   */
  public TLinkable getPrevious()
  { return troveLinkablePrevious;
  }

  /**
   * Sets the linked list node after this one.
   */
  public void setNext(TLinkable linkable)
  { troveLinkableNext = linkable;
  }

  /**
   * Sets the linked list node before this one.
   */
  public void setPrevious(TLinkable linkable)
  { troveLinkablePrevious = linkable;
  }

}

